<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="he_includePackage.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ZH-CN">
<head>
<title>发布系内公告</title>
<meta http-equiv="X-UA-Compatible" content="IE=9">
	<meta name="keywords" content="吉珠,吉林大学,吉林大学珠海学院,吉林大学珠海学院论文管理">
		<meta name="content-type" content="text/html" charset="UTF-8">
			<meta name="viewport"
				content="width=device-width, initial-scale=1, maximum-scale=1">
				<link rel="stylesheet" href=".//css/bootstrap.css" type="text/css">
					<link rel="stylesheet" href=".//css/flow.css" type="text/css">
						<script src=".//js/jquery-2.1.1.js" type="text/javascript"></script>
						<script src=".//js/bootstrap.js" type="text/javascript"></script>
						<script type="text/javascript"
							src="../jquery-easyui-1.4.1/dropZone.js"></script>
						<style>
.col-xs-3 {
	padding: 1px;
	height: 710px;
}

.col-xs-9 {
	height: 710px;
	padding: 4px;
}

#xs12 {
	height: 604px;
	width: 313px;
}
</style>
						<script type="text/javascript" language="javascript">
							$(function() {
							$('#SCT1update').dialog({  
    							width: 400,   
							    height: 200,   
							    closed: true,   
							    cache: false,   
							    modal: true  
							});   
								$('#SCT1date').datebox({   
							    required:true  
							});  
								$('#SCT1dd').dialog({   
							    width: 700,   
							    height: 750,    
							    cache: false,    
							    modal: true,
							    closed:true
							});
								$('#sctDataGrid')
										.datagrid(
												{
													url : '<%=request.getContextPath()%>/getDPMIInfo',
													pagination : true,
													singleSelect : true,
													fit : true,
													sortName : 'id',
													sortOrder : 'asc',
													fitColumns : true,
													columns : [ [
															{
																field : 'notice',
																title : '系内公共名称',
																width : 200
															},
															{
																field : 'time',
																title : '提交时间',
																width : 90
															},
															{
																field : 'subPerson',
																title : '提交人',
																width : 70
															},
															{
																field : 'btn01',
																title : '删除',
																width : 30,
																formatter : function(
																		value,
																		row,
																		index) {
																	return '<button onclick="del('+row.id+')">删除</button>';
																}
															},
															{
																field : 'btn02',
																title : '上传附件',
																width : 170,
																formatter : function(
																		value,
																		row,
																		index) {
																	return '<div id="replace'+row.id+'"><input type="file" id="file'+row.id+'" name="file" style="float:left"/><input type="button" onclick="UpladFile('+row.id+')" value="上传" style="float:right"/></div><div id="tar'+row.id+'"></div>';
																}
															} ] ]
												});
							});
							function fileLoad(){
								console.info($('#fileToUpload'));
								$('#fileToUpload1').value=$('#fileToUpload').value;
								console.info($('#fileToUpload1'));
							}
							function put(){
								console.info($('#inputfile'));
								
								$.ajax({
			url : '<%=request.getContextPath()%>/DPMIUpload',
											data : {
											},
											success : function(r) {
											},
											error : function(r) {
											}
										});
							}
							function del(index)
							{
								$.ajax({
			url : '<%=request.getContextPath()%>/DPMIdel',
											data : {
												'id' : index
											},
											success : function(r) {
												$('#sctDataGrid').datagrid(
														'reload');
											},
											error : function(r) {
											}
										});
							}
							function show() {
								$('#SCT1dd').panel('open');
							}
							
							
			function UpladFile(index) {

			$('#tar'+index+'').append("<progress id='progressBar' value='0' max='100' style='float:left'></progress><span id='percentage' ></span>");
			$('#replace'+index+'').css('display','none'); 
			
			var s="file"+index;
            var fileObj = document.getElementById(s).files[0]; // js 获取文件对象
            var FileController = "<%=request.getContextPath()%>/DPMIUpload";



            // FormData 对象
            var form = new FormData();
            form.append("author", index);                        // 可以增加表单数据
            form.append("file", fileObj);                           // 文件对象



            // XMLHttpRequest 对象
            var xhr = new XMLHttpRequest();
            xhr.open("post", FileController, true);
            xhr.onload = function () {
                alert("上传完成!");
            };
			
            xhr.upload.addEventListener("progress", progressFunction, false);
            xhr.send(form);



        }

        function progressFunction(evt) {
            var progressBar = document.getElementById("progressBar");
            var percentageDiv = document.getElementById("percentage");
            if (evt.lengthComputable) {
                progressBar.max = evt.total;
                progressBar.value = evt.loaded;
                percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";

            }

        }
        		function showWhat()
		{
			var collap=document.getElementById('collapseHelp');
			if(collap.style.display=='none')
				collap.style.display='block';
			else
				collap.style.display='none';
		}
						</script>
					</link>
				</link>
			</meta>
		</meta>
	</meta>
</meta>
</head>

<body>
	<!--全局框架 开始 conteiner-->

	<!-- <progress id="progressBar" value="0" max="100"></progress>

    <span id="percentage"></span>
	<br />
    <input type="file" id="file" name="myfile" />
    <input type="button" onclick="UpladFile(0)" value="上传" /> -->
	
	<div style="display: none">
		<form id="form1" enctype="multipart/form-data">
			<input type="file" id="fileToUpload1">
		</form>
	</div>
	<div class="container">
		<!--标题头图片-->
		<div class="row">
			<div class="body_top">
				<img src="img/head.png" align="center" width="1280px" />
			</div>
		</div>
		<!--全局12栅格 规划全局区域图线 开始 row+ col-->
		<div class="row">
			<jsp:include page="secretary_siderbar.jsp"></jsp:include>

			<!--左侧跳转框架结束-->
			<!--右侧用户操作模块 占全局9栅格-->
			<div class="col-xs-9" style="border:2px solid #25465d">
				<div class="row">
					<div class="row">
						<div class="col-xs-12  xs11"
							style="margin-bottom:0px; margin-top:5px;">
							<strong><font size="3">流程管理》发布系内公告</font> </strong>
						</div>
					</div>
					<div class="col-xs-11  xs11"
						style="margin-bottom:0px; margin-top:0px;">
						<div class="panel panel-default"
							style="margin-bottom:10px; margin-top:2px;">
							<div class="panel-heading" align="left">
								<a data-toggle="collapse" data-parent="#accordion"
									href="#collapseHelp" class="glyphicon glyphicon-chevron-down" onclick="showWhat()">
									操作指南 </a>
							</div>
							<div id="collapseHelp" class="panel-collapse collapse">
								<div class="panel-body">
									发布系内公告：
									<ul>
										<li>由教学秘书将系内公告链接发布出去。</li>
										<li>学生和老师都可以看到系内公告。</li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div style="width:100%;height:50%">
					<table id="sctDataGrid"></table>
				</div>
				<button onclick="show()">添加公告</button>
			</div>

			<!--修改结束-->
		</div>
		<!--全局12栅格 规划全局区域图线 结束 row+ col-->
	</div>
	</div>
	<div class="row" style="background-color:#25465d"">
		<p align="center" style="color:white;background-color:#25465d">
			<strong>用户单位：</strong>吉林大学珠海学院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>版权所有：</strong>吉林大学珠海学院计算机科学与技术系
		</p>
	</div>
	<div id="SCT1dd">
		<form action="<%=request.getContextPath()%>/DPMIadd" method="post">
			标题：<br><input type="text" name="title" /> <br>内容：<br><textarea
							rows="30" cols="120" name="content"></textarea> <br> <br>落款：<input
								type="text" name="inscribe" /><br> <br>日期:<input
										id="SCT1date" type="text" name="data"></input> <input
										type="submit" value="确定"/>
		</form>
	</div>

	<!--全局框架结束 conteiner-->
	</div>
</body>
</html>
